package client.test.ihm;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import fournisseur.rmi.interfaces.InterfaceFournisseur;
import serveurChatRMI.rmi.interfaces.InterfaceSujetDiscussion;

public class OpenChatWindowListnener implements ActionListener {

	InterfaceSujetDiscussion tmpSub;
	

	public OpenChatWindowListnener(String url) {
		
		
		try {
			InterfaceFournisseur fournisseur = (InterfaceFournisseur) Naming.lookup(url);
			
			tmpSub = fournisseur.getSujetDiscussion();
			
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NotBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		
		IHMChatClient chat = new IHMChatClient();
		
		
		chat.createChatWindow(tmpSub);
		
	}

}
